// Service Implementation
package com.ruoyi.examEthnicity.service.impl;

import com.ruoyi.examEthnicity.domain.ExamEthnicity;
import com.ruoyi.examEthnicity.mapper.ExamEthnicityMapper;
import com.ruoyi.examEthnicity.service.IExamEthnicityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
import java.util.Arrays;

@Service
public class ExamEthnicityServiceImpl implements IExamEthnicityService {

    @Autowired
    private ExamEthnicityMapper ethnicityMapper;

    @Override
    public ExamEthnicity selectEthnicityById(Long id) {
        return ethnicityMapper.selectEthnicityById(id);
    }

    @Override
    public List<ExamEthnicity> selectEthnicityList() {
        return ethnicityMapper.selectEthnicityList();
    }

    @Override
    public int insertEthnicity(ExamEthnicity ethnicity) {
        return ethnicityMapper.insertEthnicity(ethnicity);
    }

    @Override
    public int updateEthnicity(ExamEthnicity ethnicity) {
        return ethnicityMapper.updateEthnicity(ethnicity);
    }

    @Override
    public int deleteEthnicityByIds(Long[] ids) {
        String idStr = Arrays.stream(ids).map(String::valueOf).collect(Collectors.joining(","));
        return ethnicityMapper.deleteEthnicityByIds(idStr);
    }
}
